#pragma once


class CKImage
{
private:
	CImage  *m_Bmp;
	CImage  *m_Bmp1;
	int      m_Height;
	int      m_Width;
    int      m_SOBEL[1000][1000];
	int      m_optimal;
	CString  m_FilePath;
public:
	CKImage(void);
	~CKImage(void);

	void Init(void);
	void Close(void);

	void SetImage(CString sLoadPath);
	CImage  *GetImage(void)
	{
		return m_Bmp;
	}
	int  GetHeight()
	{
		return m_Height;
	}
	int  GetWidth()
	{
		return m_Width;
	}
	int GetOptimal(void)
	{
		return m_optimal;
	}
	bool IsMusicStaff(void);
    void ChangePixelToBlackColor(void);
    void Do_Sobel(void);
	void CenterWeight(void);
	void Do_CorrectDistortion(void);
	int  OtsuAlgorithm(void);
	int  otsu (unsigned char *image, int rows, int cols, int x0, int y0, int dx, int dy, int vvv);
	void quickSort(BYTE sort_int[],int left, int right);
	void ImageRotation(CImage *Imgn, CImage *Imgm, double alpha);
	void GetImageParament(CImage *pImg,struct IMAGEPARAMENT *ppImgParam);
	void SetRectValue(CImage *pImg,int x,int y,int Dx,int Dy,BYTE *buf);
	int	 InImage(CImage *pImg,int x,int y);
	void SetAllPalette(CImage *pImg, RGBQUAD *ColorTab);
	void GetAllPalette(CImage *pImg,RGBQUAD *ColorTab);
	int  PaletteType(RGBQUAD  *ColorTab);
	int  ImageType(CImage *pImgm);
};
